<template>
	<view class="waterfall">
		<view class="left">
			<view class="card" v-for="i in leftList" :key="i">
				<image :src="`https://picsum.photos/id/${i}/200/200`" mode="widthFix" @load="imgLoad"></image>
				<view class="info">
					<view class="text-xl">黑白简约样式名片</view>
					<view class="text-orange">会员免费</view>
				</view>
			</view>
		</view>

		<view class="right">
			<view class="card" v-for="i in rightList" :key="i">
				<image :src="`https://picsum.photos/id/${i}/200/200`" mode="widthFix" @load="imgLoad"></image>
				<view class="info">
					<view class="text-xl">黑白简约样式名片</view>
					<view class="text-orange">会员免费</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				leftList: [],
				rightList: []
			};
		},
		mounted() {
			this.getList()
		},
		methods: {
			getList() {
				let list = [123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 134, 135, 136, 140]
				list.forEach((item, index) => {
					if (index % 2) {
						this.leftList.push(item)
					} else {
						this.rightList.push(item)
					}
				})
			},
			imgLoad(e) {
				console.log(e)
			}
		}
	}
</script>

<style lang="scss">
	.waterfall {
		width: 750rpx;
		display: flex;
		justify-content: space-around;
	}

	.left,
	.right {
		width: 360rpx;
	}

	.card {
		margin: 16rpx auto;
		background: #fff;
		box-shadow: 0 0 8rpx rgba(0, 0, 0, 0.2);
		width: 100%;
		transition: all 0.3s;

		image {
			width: 100%;
			height: auto;
		}

		.info {
			padding: 16rpx;
			font-size: 20rpx;
			letter-spacing: 2rpx;

			view {
				margin: 8rpx auto;
			}
		}
	}
</style>
